{include file="general/header.tpl"}
<div id="path">
	You are here: <a href="/index.php">Home</a> &raquo; <a href="index.php">Administration</a> &raquo; <a href="assoc.php">My Account-less URLs</a>
</div>
<div id="main">
	{assign var="session_name" value=#SessionName#}
	<form action="assoc.php" method="post">
		<div class="search-form-field">
			<label>Filter by keyword:</label>
			<input type="text" name="keyword" value="{$smarty.session.$session_name.mykeywordassoc_search_string|escape}" /> <input type="submit" name="{$smarty.const.PAGINATION_RESET_FIELD_NAME}" value="Search" /> ({$smarty.const.WILDCARD_SIGN} for wildcards)
		</div>
	</form><br />
	<form action="assoc.php" method="post">
		<div class="search-form-field">
			<label>Filter by long URL:</label>
			<input type="text" name="url" value="{$smarty.session.$session_name.myurlassoc_search_string|escape}" /> <input type="submit" name="{$smarty.const.PAGINATION_RESET_FIELD_NAME}" value="Search" /> ({$smarty.const.WILDCARD_SIGN} for wildcards)
		</div>
	</form>
	{if $recover_all_assoc || $recover_assoc || $delete_assoc}
		<br />
		<div class="success">
			{if $recover_all_assoc}
				All URLs have been recovered successfully.<br />
			{/if}
			{if $recover_assoc}
				URL associated to {$recover_assoc} has been recovered successfully.<br />
			{/if}
			{if $delete_assoc}
				Assocation to {$delete_assoc} has been deleted successfully.<br />
			{/if}
		</div>
	{/if}
	<br />
	{if $paginate.total > 0 && $paginate.current_item <= $paginate.total}
		<div class="center">
			{include file="general/pagination_item_range.tpl"}
			<br /><br />
		</div>
		<form action="" method="post" onsubmit="if (!confirm('Are you sure you want to recover all your account-less URLs?')) return false;">
			<div>
				<input type="hidden" name="recover" value="all" />
				<input type="submit" name="recover_button" value="Recover all my account-less URLs" />
			</div>
		</form>
	{/if}
	<table>
		<tr>
			<td class="item_header_cell numbers">#</td>
			<td class="item_header_cell no-overflow">Keyword</td>
			<td class="item_header_cell actions">Action</td>
		</tr>
		{counter start=$paginate.first-1 print=false}
		{foreach $assocs as $assoc}
			<tr>
				<td class="item_cell numbers">{counter skip="0"}.</td>
				<td class="item_cell no-overflow">{$assoc.keyword}</td>
				{* <td class="item_cell actions"><a href="?recover={$assoc.id}" onclick="if (!confirm('Are you sure you want to recover this URL?\n\n{counter skip="1"}. {$assoc.keyword}')) return false;"><img src="../images/recover.gif" alt="Recover" title="Recover" /></a> <a href="?delete={$assoc.id}" onclick="if (!confirm('Are you sure you want to delete this association?\n\n{counter skip="1"}. {$assoc.keyword}')) return false;"><img src="../images/delete.gif" alt="Delete" title="Delete" /></a></td> *}
				{* we do not display the delete action because users are not supposed to delete associations, we want to keep track of all associations for statistics and security purposes *}
				<td class="item_cell actions"><a href="?recover={$assoc.id}" onclick="if (!confirm('Are you sure you want to recover this URL?\n\n{counter skip="1"}. {$assoc.keyword}')) return false;"><img src="../images/recover.gif" alt="Recover" title="Recover" /></a></td>
			</tr>
		{foreachelse}
			<tr><td colspan="3"><p class="center">No account-less URL matches found in the database.</p></td></tr>
		{/foreach}
	</table>
	{if $assoc@show}
		<div class="center">
			<br />
			{include file="general/pagination_page_number.tpl"}
		</div>
	{/if}
</div>
{include file="general/left.tpl"}
{include file="general/footer.tpl"}